# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Value do
  @moduledoc """
  `Value` represents a dynamically typed value which can be either be a float, a integer, a string, or a datetime value. A producer of value is expected to set one of these variants. Absence of any variant indicates an error.

  ## Attributes

  *   `booleanValue` (*type:* `boolean()`, *default:* `nil`) - Represents a boolean value.
  *   `datetimeValue` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleTypeDateTime.t`, *default:* `nil`) - Represents a datetime value.
  *   `enumValue` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumValue.t`, *default:* `nil`) - Represents an enum value.
  *   `floatValue` (*type:* `number()`, *default:* `nil`) - Represents a float value.
  *   `intValue` (*type:* `integer()`, *default:* `nil`) - Represents a integer value.
  *   `stringValue` (*type:* `String.t`, *default:* `nil`) - Represents a string value.
  *   `timestampValue` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampValue.t`, *default:* `nil`) - Represents a timestamp value.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :booleanValue => boolean() | nil,
          :datetimeValue => GoogleApi.ContentWarehouse.V1.Model.GoogleTypeDateTime.t() | nil,
          :enumValue =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumValue.t() | nil,
          :floatValue => number() | nil,
          :intValue => integer() | nil,
          :stringValue => String.t() | nil,
          :timestampValue =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampValue.t()
            | nil
        }

  field(:booleanValue)
  field(:datetimeValue, as: GoogleApi.ContentWarehouse.V1.Model.GoogleTypeDateTime)

  field(:enumValue, as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1EnumValue)

  field(:floatValue)
  field(:intValue)
  field(:stringValue)

  field(:timestampValue,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1TimestampValue
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Value do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Value.decode(value, options)
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1Value do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
